<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class LoadController extends Controller
{
    
    public function getIndex()
    {
    	// 
        return view('/home/load');
    }

    public function getAjax(Request $request)
    {
    	$row = $request->all();
    	$res = $row['php'].','.$row['html5'].','.$row['js'].','.$row['apache'].','.$row['linux'].','.$row['css'].','.$row['bootstrap'].','.$row['laravel'].',';
        //等到关注的名字的id
    	$str['tid'] = str_replace('0,','',$res);
        $user = session('user_user');
        $arr =  DB::table('zheye_user')->where('username',$user)->first();
        // echo session('user');
        $str['uid'] = $arr->id;
        // dd($str);
        $aa =  DB::table('zheye_user_love')->insert($str);
        if ($aa) {
            DB::table('zheye_user')->where('username',$user)->update(['status'=>'2']);
            echo 1;
        } else {
            echo 0;
        }
    }

}
